"""
@Version: V1.0
@Author: wilson
@License: Apache Licence
@Contact: wevsmy@qq.com
@Site: http://wevsmy.cn
@Software: PyCharm
@File: IPQuery.py
@Time: 5/11 1:53
"""
import requests

def IPQuery(IP):
    url = "http://www.ip138.com/ips138.asp"
    kv = {"ip":IP}
    try:
        data = requests.get(url, params=kv, timeout=30)
        data.raise_for_status()
        data.encoding = data.apparent_encoding
        return data.text
    except:
        return "IPQuery Error"
    pass


class Main():
    def __init__(self):
        pass


if __name__ == '__main__':
    print(IPQuery("123.207.38.118"))
    pass